<template>
	<block v-if="isAdSuccess">
	  <ad 
	    :unit-id="unitId" 
	    @load="adSucessLoad" 
	    @error="adErrorLoad"
	    :type="adType"
	  />
	</block>
</template>

<script>
	export default{
		props:{
			unitId: {
				type: String,
				default: ""
			},
			adType: {
				type: String,
				default: "banner"
			}
		},
		data() {
			return {
				isAdSuccess: true
			}
		},
		methods:{
			adSucessLoad:function() {
				this.isAdSuccess = true
				this.$emit("adLoadCallback", true);
			},
			adErrorLoad:function(e) {
				this.isAdSuccess = false
				this.$emit("adLoadCallback", false);
			}
		}
	}
</script>

<style>
	
</style>
